﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WorkFlowCore.Authorization
{
    public class AppContextManager : IAppContextManager
    {
        private readonly IWorkflowSession session;

        public AppContextManager(IWorkflowSession session)
        {
            this.session = session;
        }

        private string _appId;
        public string GetAppId()
        {
            return !string.IsNullOrWhiteSpace(_appId)? _appId: session?.User?.AppId; //兼容 session appid
        }

        public void SetAppId(string appId)
        {
            _appId = appId;
        }
    }
}
